<?php
/**
 * DetailView继承
 * User: ZFC
 * Date: 2015/7/7
 * Time: 17:32
 */

namespace common\widgets;


class DetailView extends \yii\widgets\DetailView
{

    public $cols = 1;

    protected function renderAttribute($attribute, $index)
    {
        $templatestr = "";
        if ($index % 2 != 1) {
            $templatestr .= "<tr>";
            if (is_string($this->template)) {
                $templatestr .= strtr($this->template, [
                    '{label}' => $attribute['label'],
                    '{value}' => $this->formatter->format($attribute['value'], $attribute['format']),
                ]);
            }
        }else{
            $templatestr .= strtr($this->template, [
                '{label}' => $attribute['label'],
                '{value}' => $this->formatter->format($attribute['value'], $attribute['format']),
            ]);
            $templatestr .= "</tr>";
        }
        return $templatestr;
    }
}